axios.defaults.baseURL='http://api-breakingnews-web.itheima.net'
axios.interceptors.request.use(config => {
// console.log(config);
 if(config.url.indexOf('/my')!==-1){
   config.headers.Authorization=localStorage.getItem('token')
 }
return config;
},error => {
return Promise.reject(error);
});
axios.interceptors.response.use(response => {
  if(response.data.status===1&&response.data.message==='身份认证失败！'){
   localStorage.removeItem('token')
    return location.href='/login.html'
 }
return response;
},error => {
return Promise.reject(error);
});